package com.cskaoyan.dbutils.resultsetHandler;

import com.cskaoyan.opensource.C3p0Utils;
import com.cskaoyan.opensource.DruidUtils;
import org.apache.commons.dbutils.QueryRunner;
import org.apache.commons.dbutils.handlers.MapHandler;

import java.sql.SQLException;
import java.util.Map;

/**
 * 创建日期: 2022/11/19 09:35
 *
 * @author ciggar
 */
public class MapHandlerDemo {

    public static void main(String[] args) throws SQLException {

        // 1. 获取QueryRunner
        QueryRunner queryRunner = new QueryRunner(C3p0Utils.getDataSource());

        // 2. 执行SQL语句
        Map<String, Object> map = queryRunner.query("select * from account where id = ?", new MapHandler(), 1001);

        System.out.println(map);
    }
}
